package com.cy.entity;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * <p>Description: [后台角色权限中间表]</p>
 * @author         [曹悦] 
 */
@Entity
@Table(name = "CY_BACK_ROLEPURVIEW")
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true )
public class BackRolePurView {
	private Long id;
	private BackRole role;
	private BackPurview purview;
	
	@Id
	@SequenceGenerator(name = "CY_BACK_ROLEPURVIEW_SEQ", sequenceName = "CY_BACK_ROLEPURVIEW_SEQ",allocationSize=1,initialValue=1)
	@GeneratedValue(strategy = GenerationType.IDENTITY, generator = "CY_BACK_ROLEPURVIEW_SEQ")
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	
	@ManyToOne(optional = false, fetch = FetchType.LAZY)
	@JoinColumn(name = "purview_id", nullable = false)
	public BackPurview getPurview() {
		return purview;
	}
	public void setPurview(BackPurview purview) {
		this.purview = purview;
	}
	
	@ManyToOne(optional = false, fetch = FetchType.LAZY)
	@JoinColumn(name = "role_id", nullable = false)
	public BackRole getRole() {
		return role;
	}
	public void setRole(BackRole role) {
		this.role = role;
	}
	
	
}
